<template>
	<view class="item pull-left">
		<navigator hover-class="none" :url="`/pages/shop/shopinfo?store_id=${item.item_id}&latitude=${latitude}&longitude=${longitude}`">
			<image v-if="host" :src="`${host}${item.recommend_image}-t.m90xx`" class="w100" mode="aspectFill" lazy-load="true"></image>
			<!-- <image :src="`${host}${item.recommend_image}`" class="w100" mode="widthFix" lazy-load="true"></image> -->
			<view class="info">
				<view class="info__name u-line-2">
					<text class="tag">{{ item.item_name }}</text>
				</view>
				<view class="info__star"><Star :score="evaluate_score" /></view>
				<view class="info__coupon" v-if="item.coupon.length > 0">
					<text class="info__coupon__item" v-for="(couponItem, index) in coupon" :key="couponItem.id">
						{{ couponItem.full_quota }} 减 {{ couponItem.reduce_quota }}
					</text>
				</view>
				<view class="info__bottom">
					<text class="read-number" v-if="Number(item.uniformity) > 0">
						<text>人均</text>
	
						<text class="price-currency">￥</text>
						{{ item.uniformity }}
						<text class="info__ver-line">|</text>
					</text>
					<text class="info__distance">{{ item.juli / 1000 }}km</text>
				</view>
			</view>
		</navigator>
	</view>
</template>

<script>
import { mapGetters } from 'vuex';
import Star from '../components/public/star.vue';

export default {
	data() {
		return {
			evaluate_score: null,
			latitude:'',
			longitude:'',
			coupon:  this.item.coupon.length > 0 ? this.item.coupon.slice(0, 2) : []
		};
	},
	props: {
		item: {
			type: Object,
			default() {
				return {
				};
			}
		}
	},
	computed: {
		host() {
			return this.$baseHost.qiniuHost;
		},
		...mapGetters(['openId']),
	},
	created() {
		this.latitude=uni.getStorageSync('location').latitude || '';
		this.longitude=uni.getStorageSync('location').longitude  || '';
		this.evaluate_score = (Number(this.item.evaluate_score)/Number(this.item.evaluate_num)).toFixed(2);
	},
	components: {
		Star
	},
	methods: {}
};
</script>

<style lang="less">
</style>
